package com.rtx.wms.std.qm.service;

import com.qimen.api.QimenClient;
import com.rtx.wms.std.qm.bean.ReceiverinfoQueryRequest;
import com.rtx.wms.std.qm.bean.ReceiverinfoQueryResponse;
import com.rtx.wms.std.so.bean.ApiOrders;
import com.taobao.api.ApiException;
import org.springframework.stereotype.Service;

/**
 * 收件人信息解密
 */
@Service
public class ReceiverinfoQueryService extends QimenService{

    /**
     * 收件人信息解密接口
     */
    public void receiverinfoQuery(ApiOrders apiOrders){
        QimenClient client = getQimenClient();
        ReceiverinfoQueryRequest req = new ReceiverinfoQueryRequest();
        req.setCustomerId("");
        req.setDeliveryordercode(apiOrders.getExternorderkey());
        try {
            ReceiverinfoQueryResponse rsp = client.execute(req);
            if(rsp.isSuccess()){
//                apiOrders.setcContact1(rsp.getReceiverInfo().getName());
//                apiOrders.setcPhone1(rsp.getReceiverInfo().getMobile());
//                apiOrders.setcPhone2(rsp.getReceiverInfo().getTel());
//                apiOrders.setcAddress1(rsp.getReceiverInfo().getDetailAddress());
            }
        } catch (ApiException e) {
            logger.error("订单：{}，收件人信息解密异常", apiOrders.getExternorderkey(),e);
        }
    }
}
